package com.idea.plugin.window;

import com.idea.plugin.ui.WindowUI;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentFactory;
import org.jetbrains.annotations.NotNull;

/**
 * @author yanzhao
 * @date 2021/12/27 20:38
 * @since 1.0.0
 */
public class WindowFactory implements ToolWindowFactory {

    @Override
    public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
        final WindowUI windowUI = new WindowUI();
        final ContentFactory instance = ContentFactory.SERVICE.getInstance();
        final Content content = instance.createContent(windowUI.createComponent(), "Hello world - displayName", false);
        toolWindow.getContentManager().addContent(content);
    }
}
